package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.IUserService;
import service.UserService;
import serviceimpl.UserServiceImpl;

/**
 * Servlet implementation class DeleteUserById
 */
@WebServlet("/DeleteUserById")
public class DeleteUserById extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 int id=Integer.parseInt(request.getParameter("Id"));
		 IUserService us=new UserServiceImpl();
		   boolean flag=us.deleteUserById(id);
		   if(flag) {
			     request.setAttribute("error", "delok");
			  	 
		   }else {
			   request.setAttribute("error", "delno");
		   }
		   request.getRequestDispatcher("QueryUserByPageNowServlet").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		doGet(request, response);
	}

}
